package demo3;

import java.util.Scanner;

public class char9 {
    public static void main(String[] args) {
        //键盘录入一个字符串
        //要求：长度小于等于9、只能是数字
        //1-Ⅰ，2-Ⅱ依次
        Scanner sc =new Scanner(System.in);
        String str;
        while (true) {
            System.out.println("请输入一个字符串：");

            str = sc.next();
            boolean flag=checkStr(str);
            if(flag){

                break;
            }else {
                System.out.println("当前输入字符串不合格，请重新输入:");
            }
        }
        for (int i = 0; i < str.length(); i++) {
            char c=str.charAt(i);
            //System.out.println(c);'1','2','3'
            int number=c-48;
//            System.out.println(number);
            String s=changeLuoMa(number);
            System.out.println(s);
        }

    }
    public static String changeLuoMa(int number){
        String[]arr={"","Ⅰ","Ⅱ","Ⅲ","Ⅳ","Ⅴ","Ⅵ","Ⅶ","Ⅷ","Ⅸ"};
        return arr[number];
    }
    public static boolean checkStr(String str){
        if(str.length()>=9){
            return false;
        }
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if(c<'0'||c>'9'){
                return false;
            }
        }return true;
    }
}
